﻿using System;
using System.Collections;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Web;

using Mvc.XForms.Controls.Formatters;
using Mvc.XForms.Controls.Settings;
using Mvc.XForms.Utilities;

namespace Mvc.XForms.Controls {
	public class Trigger<TContext> : CoreControlBase<TContext>, ITrigger<TContext> {
		public TriggerSettings<TContext> Settings { get; private set; }

		public override XFormControlType ControlType {
			get { return XFormControlType.Trigger; }
		}

		public Trigger(IContainerControl<TContext> parent, string id)
			: base(parent, id) {
			CssClass.Add("trigger");
			Settings = new TriggerSettings<TContext>(this);
			Appearance = Appearance.Full;
		}

		protected override Func<object> SetValueAction {
			get { return () => null; }
		}

		public override string Render() {
			var control = XForm.Formatter.Trigger(this);
			return control;
		}
	}
}